Hi all, I'm would like to bring back the latest baseline version and name of a number of different modules using their uniqueID. The reason for the uniqueID is that it is likely that the module will move to a different folder but I don't want to update the filepath each time the module moves so i'm hoping there is a way to do it by the uniqueID.
Module m = current
Baseline b = getMostRecentBaseline(m)
prot = (m."Name")" = v"(major b)"."(minor b)(suffix b)" "(annotation b)
Item i1 = itemFromID("48c520b3464303c3-0000e324")
Module m1 (Item i1)
Baseline b1 = getMostRecentBaseline(m1)
busrul = (m1."Name")" = v"(major b)"."(minor b1)(suffix b1)" "(annotation b1)
m."Baseline Versions"= prot"\n" busrul""
dnmel0 - Mon Aug 15 22:24:58 EDT 2011 |
Re: Get handle on other module to bring back name and latest baseline version
Hi Dan, mod = module(itm) where 'mod' must be a module variable, and 'itm' a item variable. You have Module m1 (Item i1)
which for reasons I don't understand does not throw a DXL error, but also does not give you the correct Module handel neither. Module m1 = module(i1)
then still the Module handle might be null, if the Module is not open yet. You hence need an if clause to check, and a call to "read(Module mod)" if necessary.
Module currMod = current Module
Baseline currBas
string prot, busrul
Item itm
Module otherMod
Baseline otherBas
bool otherModuleWasOpen = true
if (!null currMod)
{ // Current Module is not null
currBas = getMostRecentBaseline(currMod)
if (!null currBas){prot = (name currMod)" = v"(major currBas)"."(minor currBas)(suffix currBas)" "(annotation currBas)}
else {prot = (name currMod)" : No baseline"}
itm = itemFromID("00000972")
if (!null itm)
{ // Item is not null
Module m1 (Item i1)
otherMod = module(itm)
if (null otherMod){otherMod = read(fullName itm, false); otherModuleWasOpen = false}
if (!null otherMod)
{ // Other Module is not null
otherBas = getMostRecentBaseline(otherMod)
if (!null otherBas){busrul = (name otherMod)" = v"(major otherBas)"."(minor otherBas)(suffix otherBas)" "(annotation otherBas)}
else {busrul = (name otherMod)" : No baseline"}
if (!otherModuleWasOpen){close otherMod}
} // Other Module is not null
else {busrul = "Failed to open other Module"}
} // Item is not null
else {busrul = "Invalid item ID"}
//currMod."Baseline Versions"= prot"\n" busrul""
print prot"\n" busrul ""
} // Current Module is not null
|